
#pragma once
#include "Character_define.h"
#include "MeshNodeBase.h"

class CSkelMeshNode : public CMeshNodeBase
{
	friend class CModelRender;
	friend class CModelStructTransf;
	friend class CSkeletonMesh;
public:
	CSkelMeshNode() : m_dwTextureFactor(0),m_pD3DBoneCombin(NULL),
		m_puD3DBoneCombinCount(NULL)
	 {
	 }
	 virtual ~CSkelMeshNode()
	 {
		 Term();
	 }

	 void SetTextureFactor(const DWORD& dwFactor)
	 {
		 m_dwTextureFactor = dwFactor;
	 }

protected:
	 virtual void SerialD3D(CIArchive& ar);
	 virtual void SerialMem(CIArchive& ar);//to data transform from old;
	 virtual void SerialBase(CIArchive& ar);
	 virtual void Term();

protected:	

	uint32 m_uMaxFaceInfl;
	uint32  m_uPattr;
	uint32* m_puD3DBoneCombinCount;

	D3DXMATRIX m_matFCloth;
	D3DXMATRIX m_matBCloth;	

	LPD3DXBONECOMBINATION  m_pD3DBoneCombin;
	DWORD m_dwTextureFactor;

	BYTE*  m_pVertices;
	WORD*  m_pIdices;
};

class CSkelMeshNodeInstance : public CMeshNodeInstance
{
public:
	CSkelMeshNodeInstance(const int& iTppe,const int& iIndex = 0) : CMeshNodeInstance(iTppe,iIndex),m_pMeshNode(NULL)
	{
	}
	inline void SetMesh(CSkelMeshNode* pMeshNode)
	{
		m_pMeshNode = pMeshNode;
	}
	inline CSkelMeshNode* GetMesh()
	{
		return m_pMeshNode;
	}
private:
	CSkelMeshNode* m_pMeshNode;
};